import path from 'path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import WindiCSS from 'vite-plugin-windicss'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': path.join(__dirname, 'src'),
    },
  },
  server: {
    host: '0.0.0.0',
    port: 8889,
    // proxy: {
    //   '/api': {
    //     target: `http://localhost:${process.env.PORT}/api`,
    //     rewrite: path => path.replace(/^\/api/, ''),
    //   },
    // },
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        modifyVars: { '@primary-color': '#13c2c2' },
      },
      // ....
    },
  },
  plugins: [
    WindiCSS(),
    react({
      jsxImportSource: '@emotion/react',
      babel: {
        plugins: ['@emotion/babel-plugin'],
      },
    }),
  ],
});